<?php
/**
 * @param ParamFdkBasis $ParamFdkBasis
 */
class ParamFdkBasesController extends AppController {

	var $name = 'ParamFdkBases';

  /**
   * INDEX
   */
	function index() {
		$this->ParamFdkBasis->recursive = 0;
		$this->set('paramFdkBases', $this->paginate());
	}

  /**
   *  VIEW
   * @param type $id 
   */
	function view($id = null) {
    
		if (!$id) {
			$this->Session->setFlash(__('Invalid param fdk basis', true));
			$this->redirect(array('action' => 'index'));
		}
		$this->set('paramFdkBasis', $this->ParamFdkBasis->read(null, $id));
	}

  /**
   * ADD
   */
	function add() {
    
		if (!empty($this->data)) {
			$this->ParamFdkBasis->create();
			if ($this->ParamFdkBasis->save($this->data)) {
				$this->Session->setFlash(__('The param fdk basis has been saved', true));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The param fdk basis could not be saved. Please, try again.', true));
			}
		}
    
    
		$paramFdkFilters = $this->ParamFdkBasis->ParamFdkFilter->find('list');
		$this->set(compact('paramFdkFilters'));
	}

  /**
   * EDIT
   * @param type $id 
   */
	function edit($id = null) {
    
    // If bad id
		if (!$id && empty($this->data)) {
			$this->Session->setFlash(__('Invalid param fdk basis', true));
			$this->redirect(array('action' => 'index'));
		}
    // If ready to submit data
		if (!empty($this->data)) {
			if ($this->ParamFdkBasis->save($this->data)) {
				$this->Session->setFlash(__('The param fdk basis has been saved', true));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The param fdk basis could not be saved. Please, try again.', true));
			}
		}
    
    // If new edit screen
		if (empty($this->data)) {
			$this->data = $this->ParamFdkBasis->read(null, $id);
		}
    
		$paramFdkFilters = $this->ParamFdkBasis->ParamFdkFilter->find('list');
		$this->set(compact('paramFdkFilters'));
	} //////////////// end edit() //////////////////////

  /**
   * DELETE
   * @param type $id 
   */
	function delete($id = null) {
    
		if (!$id) {
			$this->Session->setFlash(__('Invalid id for param fdk basis', true));
			$this->redirect(array('action'=>'index'));
		}
		if ($this->ParamFdkBasis->delete($id)) {
			$this->Session->setFlash(__('Param fdk basis deleted', true));
			$this->redirect(array('action'=>'index'));
		}
		$this->Session->setFlash(__('Param fdk basis was not deleted', true));
		$this->redirect(array('action' => 'index'));
	}
}  ///////////////////////// end class ////////////////////////////////
